﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI;
using EPiSugar.Markup;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;

namespace EPiSugar.Tests.Markup
{
    [TestFixture]
    public class WhileCreatingMarkup
    {
        Page p = new Page();

        [Test]
        public void CanCreate_Anchor()
        {
            string html = p.Tags().A("/link/to/page", "link text");

            Assert.That(html, Is.EqualTo("<a href=\"/link/to/page\">link text</a>"));
        }

        [Test]
        public void Anchor_WithNullHref_IsNull()
        {
            string html = p.Tags().A(null, "link text");

            Assert.That(html, Is.Null);
        }

        [Test]
        public void CanCreate_Image()
        {
            string html = p.Tags().Img("/path/to/image.jpg");

            Assert.That(html, Is.EqualTo("<img src=\"/path/to/image.jpg\"/>"));
        }

        [Test]
        public void CanCreate_Image_WithAltText()
        {
            string html = p.Tags().Img("/path/to/image.jpg", "I'm alternative for sure");

            Assert.That(html, Is.EqualTo("<img src=\"/path/to/image.jpg\" alt=\"I'm alternative for sure\"/>"));
        }
    }
}
